package cn.chainco.cts.jdo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

//工作单相关文档
@Entity
@Table(name = "cts_workdoc")
public class WorkDoc implements Serializable {
	private static final long serialVersionUID = -832914351261208659L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "workId")
	private Work work; // 工作单id
	
	@Column(length = 50)
	private String name; // 文档名字
	
	@Column(length = 100)
	private String content; // 文档内容

	@Column(nullable = false)
	private Integer type = 0; // 0.从模版生成，1.上传

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "employeeId")
	private Employee employee; // 上传或生成者

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "docTemplateId")
	private DocTemplate docTemplate; // 模版

	@Column
	private Long parentId; // 父Id，供查看历史存档用

	@Column(length = 100)
	private String path; // 上传路径

	@Temporal(TemporalType.TIMESTAMP)
	private Date operateTime; // 操作时间

	@Column(length = 500)
	private String shareUsers; // 共享用户，多用户id用逗号隔开，包括已读未读状态

	@Transient
	private Integer option1; // 可选临时字段

	@Transient
	private Integer option2; // 可选临时字段
	
	@Transient
	private String option3; // 可选临时字段

	@Transient
	private String option4; // 可选临时字段

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Work getWork() {
		return work;
	}

	public void setWork(Work work) {
		this.work = work;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public DocTemplate getDocTemplate() {
		return docTemplate;
	}

	public void setDocTemplate(DocTemplate docTemplate) {
		this.docTemplate = docTemplate;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Date getOperateTime() {
		return operateTime;
	}

	public void setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
	}

	public String getShareUsers() {
		return shareUsers;
	}

	public void setShareUsers(String shareUsers) {
		this.shareUsers = shareUsers;
	}

	public Integer getOption1() {
		return option1;
	}

	public void setOption1(Integer option1) {
		this.option1 = option1;
	}

	public Integer getOption2() {
		return option2;
	}

	public void setOption2(Integer option2) {
		this.option2 = option2;
	}

	public String getOption3() {
		return option3;
	}

	public void setOption3(String option3) {
		this.option3 = option3;
	}

	public String getOption4() {
		return option4;
	}

	public void setOption4(String option4) {
		this.option4 = option4;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

}
